package _1_simple_factory

import (
	"fmt"
	"strings"
)

type Car interface {
	gotwork()
}

func NewCar(str string) Car{
	if strings.Contains(str,"bus") {
		return &Bus{}
	} else {
		return &Bike{}
	}
}
type Bus struct {

}

type Bike struct {

}

func (this *Bus) gotwork(){
	fmt.Println("坐公交上班")
}

func (this *Bike) gotwork(){
	fmt.Println("骑自行车上班")
}